﻿@{
	ViewData["Title"] = "RawMaterialAdd";
	Layout = "~/Views/Home/Menu.cshtml";
}

<h1>原料添加</h1>

<form class="layui-form" action="">
	<div class="layui-form-item">
		<label class="layui-form-label">原料编号</label>
		<div class="layui-input-inline layui-input-wrap;line - spacing:600">
			<input type="text" name="rawMaterialNumbering" id="rawMaterialNumbering" lay-verify="required" autocomplete="off" lay-affix="clear" class="layui-input">
		</div>

		<label class="layui-form-label">原料名称</label>
		<div class="layui-input-inline layui-input-wrap">
			<input type="text" name="rawMaterialName" id="rawMaterialName" lay-verify="required" autocomplete="off" lay-affix="clear" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">原料分类</label>
		<div class="layui-input-inline layui-input-wrap;line - spacing:600">
			<select name="rawMaterialClassify" id="rawMaterialClassify" lay-verify="required" lay-search>
				<option value="">请选择</option>
				<option value="五金">五金</option>
			</select>
		</div>

		<label class="layui-form-label">尺寸</label>
		<div class="layui-input-inline layui-input-wrap">
			<select name="rawMaterialSize" id="rawMaterialSize" lay-verify="required" lay-search>
				<option value="">请选择</option>
				<option value="8mm">8mm</option>
				<option value="10mm">10mm</option>
				<option value="12mm">12mm</option>
				<option value="14mm">14mm</option>
				<option value="16mm">16mm</option>
				<option value="18mm">18mm</option>
				<option value="20mm">20mm</option>
			</select>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">规格型号</label>
		<div class="layui-input-inline layui-input-wrap;line - spacing:600">
			<select name="rawMaterialSpecModel" id="rawMaterialSpecModel" lay-verify="required" lay-search>
				<option value="">请选择</option>
				<option value="M8">M8</option>
				<option value="M10">M10</option>
				<option value="M12">M12</option>
				<option value="M14">M14</option>
				<option value="M16">M16</option>
				<option value="M18">M18</option>
				<option value="M20">M20</option>
			</select>

		</div>

		<label class="layui-form-label">原料属性</label>
		<div class="layui-input-inline layui-input-wrap">
			<select name="rawMaterialAttribute" id="rawMaterialAttribute" lay-verify="required" lay-search>
				<option value="">请选择</option>
				<option value="采购">采购</option>
				<option value="自制">自制</option>
			</select>
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">单位</label>
		<div class="layui-input-inline layui-input-wrap;line - spacing:600">
			<select name="rawMaterialUnit" id="rawMaterialUnit" lay-verify="required" lay-search>
				<option value="">请选择</option>
				<option value="个">个</option>
				<option value="箱">箱</option>
				<option value="件">件</option>
				<option value="套">套</option>
				<option value="台">台</option>
			</select>

		</div>

		<label class="layui-form-label">库存数量</label>
		<div class="layui-input-inline layui-input-wrap">
			<input type="text" name="rawMaterialinventory" id="rawMaterialinventory" lay-verify="required" autocomplete="off" lay-affix="number" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">原料类型</label>
		<div class="layui-input-inline layui-input-wrap;line - spacing:600">
			<select name="rawMaterialType" id="rawMaterialType" lay-verify="required" lay-search>
				<option value="">请选择</option>
				<option value="半成品">半成品</option>
				<option value="成品">成品</option>
				<option value="原料">原料</option>
			</select>

		</div>

		<label class="layui-form-label">状态</label>
		<div class="layui-input-inline layui-input-wrap">
			<input type="radio" name="rawMaterilStatus" id="rawMaterilStatus" value="禁用" title="禁用" checked>
			<input type="radio" name="rawMaterilStatus" id="rawMaterilStatus" value="启用" title="启用">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">原料数量</label>
		<div class="layui-input-inline layui-input-wrap;line - spacing:500">
			<input type="text" name="rawMaterialNumber" id="rawMaterialNumber" lay-verify="required" autocomplete="off" lay-affix="number" class="layui-input">
		</div>

		<label class="layui-form-label">报警天数</label>
		提前<div class="layui-inline">
			<div class="layui-input-inline layui-input-wrap" style="width: 100px;">
				<input type="number" name="rawMaterialDay" id="rawMaterialDay" placeholder="" autocomplete="off" class="layui-input" min="0" step="1" lay-affix="number">
			</div>
		</div>天报警
	</div>

	<div class="layui-form-item">
		<label class="layui-form-label">库存上限</label>
		<div class="layui-input-inline layui-input-wrap;line - spacing:600">
			<input type="text" name="inventoryMaximums" id="inventoryMaximums" lay-verify="required" autocomplete="off" lay-affix="clear" class="layui-input">
		</div>

		<label class="layui-form-label">库存下限</label>
		<div class="layui-input-inline layui-input-wrap">
			<input type="text" name="inentoryLower" id="inentoryLower" lay-verify="required" autocomplete="off" lay-affix="clear" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item">
		<label class="layui-form-label">原料位置</label>
		<div class="layui-input-inline layui-input-wrap;line - spacing:600">
			<input type="text" name="rawMateriallocation" id="rawMateriallocation" lay-verify="required" autocomplete="off" lay-affix="clear" class="layui-input">
		</div>

		<label class="layui-form-label">创建时间</label>
		<div class="layui-input-inline layui-input-wrap">
			<div class="layui-input-prefix">
				<i class="layui-icon layui-icon-date"></i>
			</div>
			<input type="date" name="rawMaterialDate" id="rawMaterialDate" autocomplete="off" lay-verify="required" class="layui-input">
		</div>
	</div>
	<div class="layui-form-item layui-form-text">
		<label class="layui-form-label">备注</label>
		<div class="layui-input-block" style="width:600Px">
			<textarea name="rawMaterialReamrk" id="rawMaterialReamrk" placeholder="请输入内容" class="layui-textarea"></textarea>
		</div>
	</div>

	<button type="button" class="layui-btn" id="ID-upload-demo-btn">
		<i class="layui-icon layui-icon-upload"></i> 单图片上传
	</button>
	<div style="width: 132px;">
		<div class="layui-upload-list">
			<img class="layui-upload-img" name="rawMaterialImage" id="rawMaterialImage" style="width: 100%; height: 92px;">
			<div id="ID-upload-demo-text"></div>
		</div>
	</div>
	<div class="layui-form-item">
		<button type="submit" class="layui-btn" lay-submit lay-filter="formSubmit">立即提交</button>
		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
	</div>
</form>
<script src="~/js/rawmaterialcontroller1/rawmaterialadd.js"></script>
<script>

	//对接mio进行获取地址
	layui.use(function () {
		var upload = layui.upload;
		var layer = layui.layer;
		var element = layui.element;
		var $ = layui.$;
		// 单图片上传
		var uploadInst = upload.render({
			elem: '#ID-upload-demo-btn',
			url: 'http://localhost:5093/api/RawMaterials/Uimg', // 实际使用时改成您自己的上传接口即可。
			before: function (obj) {
				// 预读本地文件示例，不支持ie8
				obj.preview(function (index, file, result) {
					$('#rawMaterialImage').attr('src', result); // 图片链接（base64）
				});

				element.progress('filter-demo', '0%'); // 进度条复位
				layer.msg('上传中', { icon: 16, time: 0 });
			},
			done: function (res) {
				//console.log(res)
				// 若上传失败
				if (res.code == 0) {
					return layer.msg('上传成功');
				}
				else {
					$('#ID-upload-demo-text').html(''); // 置空上传失败的状态
					return layer.msg('上传失败')

				}

				// 上传成功的一些操作
				// …

			},
			error: function () {
				// 演示失败状态，并实现重传
				var demoText = $('#ID-upload-demo-text');
				demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
				demoText.find('.demo-reload').on('click', function () {
					uploadInst.upload();
				});
			},

		});

	});

</script>
